package com.are.servelet;

import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Servlet implementation class SvrBase
 */
@WebServlet("/SvrBase")
public abstract class  SvrBase extends HttpServlet {
	private static final long serialVersionUID = 1L;
	public static String formatoHTML="text/html;charset=ISO-8859-1";
	
	HttpServletRequest request;
	HttpServletResponse response;
	PrintWriter out ;
	HttpSession sesion;
	
	
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SvrBase() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		ProcesarPeticion(request,response);		
	}
	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		ProcesarPeticion(request,response);
	}
	protected void ProcesarPeticion(HttpServletRequest request, HttpServletResponse response) throws IOException{
		response.setContentType(formatoHTML);
		this.request=request;
		this.response=response;
		this.out= response.getWriter();
		this.sesion=request.getSession();
		ProcesarPeticion();
	}
	//Esta metodo debe implementar en cada servelet 
	 protected abstract void ProcesarPeticion() throws IOException;

}
